<template>
	<view class="P_2">
		<view class="bg_fff B_radius_5 P_2">
			<view class="PTB_2" style="display: flex;align-items: flex-end;">
				请输入新昵称
				<view class="fontS_10 color_gray" >
					(昵称最多五个字)
				</view>
			</view>
			<view class="PTB_2 line_bom">
				<input type="text" maxlength="5" placeholder="请输入..." v-model="name" />
			</view>
		</view>
		
		<view @click="submit" class="pub_bg color_fff flex_rowC MT_4 PTB_2 B_radius_5">
			确定
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'',
			}
		},
		methods: {
			submit(){
				let _this = this;
				if(!this.name){
					this.toast('请输入您的昵称')
				}else{
					this.$req('user/profile',{name:_this.name},function(res){
						if(res.code==1){
							_this.toast('修改成功');
							setTimeout(function(){
								uni.navigateBack({
									delta:1
								})
							},500)
						}else{
							_this.toast(res.msg)
						}
					})
				}
				
			}
		}
	}
</script>

<style>

</style>
